var t = null,
  e = null;
Component({
  properties: {
    tapLife: {
      type: Boolean,
      value: !1,
      observer: function () {
        var t = this,
          e = setTimeout(function () {
            t.move(), t.footer(), t.playBird(), clearTimeout(e);
          }, 1e3);
      },
    },
  },
  data: {
    relicsList: [],
    offsetLeft: 0,
    showVideo: !1,
    title: "鉴赏·生活崇拜",
    desc: "上滑探索出土坑",
    showfooter: !1,
    showbird: !0,
    style: "",
    current: 0,
    count: 39,
    currentBird: 0,
    countBird: 168,
  },
  attached: function () {
    var t = wx.getSystemInfoSync(),
      e = [
        {
          title: "鸟崇拜",
          style: "border: none;position: absolute;top: calc(0.15 * "
            .concat(t.screenHeight, "px);left: calc(")
            .concat((298.08 * t.screenHeight) / 736, "px); width: ")
            .concat((172 * t.screenHeight) / 736, "rpx;height: ")
            .concat((172 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
        {
          title: "鱼崇拜",
          style: "border: none;position: absolute;bottom: calc(0.18 * "
            .concat(t.screenHeight, "px);left: calc(")
            .concat((322.92 * t.screenHeight) / 736, "px); width: ")
            .concat((110 * t.screenHeight) / 736, "rpx;height: ")
            .concat((110 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
        {
          title: "蛇崇拜",
          style: "border: none;position: absolute;bottom: calc("
            .concat((33.12 * t.screenHeight) / 736, "px);left: calc(0.24 * ")
            .concat(t.screenWidth, "px); width: ")
            .concat((172 * t.screenHeight) / 736, "rpx;height: ")
            .concat((172 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
        {
          title: "龙崇拜",
          style: "border: none;position: absolute;top: calc(0.5 * "
            .concat(t.screenHeight, "px);left: calc(")
            .concat((0.98 * 414 * t.screenHeight) / 736, "px); width: ")
            .concat((172 * t.screenHeight) / 736, "rpx;height: ")
            .concat((172 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
        {
          title: "太阳崇拜",
          style: "border: none;position: absolute;top: calc(0.48 * "
            .concat(t.screenHeight, "px);left: calc(")
            .concat((1.38 * 414 * t.screenHeight) / 736, "px); width: ")
            .concat((140 * t.screenHeight) / 736, "rpx;height: ")
            .concat((140 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
        {
          title: "虎崇拜",
          style: "border: none;position: absolute;top: calc(0.5 * "
            .concat(t.screenHeight, "px);left: calc(")
            .concat((0.2 * 414 * t.screenHeight) / 736, "px); width: ")
            .concat((140 * t.screenHeight) / 736, "rpx;height: ")
            .concat((140 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
        {
          title: "眼睛崇拜",
          style: "border: none;position: absolute;top: calc(0.42 * "
            .concat(t.screenHeight, "px);left: calc(")
            .concat((0.56 * 414 * t.screenHeight) / 736, "px); width: ")
            .concat((122 * t.screenHeight) / 736, "rpx;height: ")
            .concat((122 * t.screenHeight) / 736, "rpx;z-index:100;"),
        },
      ];
    this.setData({ relicsList: e });
  },
  methods: {
    showCard: function (t) {
      var e = t.currentTarget.dataset.index;
      this.triggerEvent("onShowLifeCard", { activeIndex: e });
    },
    move: function () {
      var t = this;
      this.setData({ offsetLeft: 0 });
      var e = 0,
        c = setInterval(function () {
          150 === (e += 1) && clearInterval(c),
            t.setData({ offsetLeft: t.data.offsetLeft + 1 });
        }, 20);
    },
    footer: function () {
      var t = this,
        e = 0;
      e = setTimeout(function () {
        t.play(), t.setData({ showfooter: !0 }), clearTimeout(e);
      }, 3e3);
      var c = 0;
      c = setTimeout(function () {
        t.setData({ showfooter: !1 }), clearTimeout(c);
      }, 7e3);
      var n = 0;
      clearTimeout(n),
        (n = setTimeout(function () {
          t.setData({ showbird: !1 });
        }, 15e3));
    },
    play: function () {
      var e = this;
      t && (clearInterval(t), (t = null)),
        this.setData({ current: 0, style: "" }, function () {
          t = setInterval(function () {
            if (e.data.current === e.data.count)
              return clearInterval(t), void (t = null);
            e.setData({
              current: e.data.current + 1,
              style: e.getStyle(e.data.current + 1),
            });
          }, 4e3 / 39);
        });
    },
    getStyle: function (t) {
      return [
        "transform: translate3d(calc(106px * -1 * (".concat(t, " - 1)), 0, 0)"),
      ].join(";");
    },
    playBird: function () {
      var c = this;
      e && (clearInterval(e), (e = null)),
        this.setData({ currentBird: 0, styleBird: "" }, function () {
          e = setInterval(function () {
            if (c.data.currentBird === c.data.countBird)
              return clearInterval(t), void (e = null);
            c.setData({
              currentBird: c.data.currentBird + 1,
              styleBird: c.getBirdStyle(c.data.currentBird + 1).style,
            });
          }, 14e3 / 168);
        });
    },
    getBirdStyle: function (t) {
      var e = (t - 1) % 7,
        c = Math.floor((t - 1) / 7);
      return {
        style: "left:calc(-500px * "
          .concat(e, ");top:calc(-100px * ")
          .concat(c, ");"),
      };
    },
  },
});
